<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button>点击我请求xml数据</button>
		
		
		<script type="text/javascript">
		// 1.数据格式  2.返还的头部(response header)一定要设置  text/xml
			// 利用ajax获取xml数据
			var btn = document.querySelector("button");
			btn.onclick = function(){
				// 获取数据get ：获取 
				let xhr = new XMLHttpRequest();
				xhr.open("GET","xml.php",true);
				xhr.onload = function(){
					// console.log(xhr.responseXML);
				 let res = 	xhr.responseXML.querySelector("nodejs name").innerHTML;
				 console.log(res);
				}
				xhr.send();
				
				
			}
			
			
			
		</script>
	</body>
</html>
